package com.speedjustice.Controller;

import com.speedjustice.model.Student;
import com.speedjustice.service.StudentService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.sql.SQLException;
import java.util.List;

/**
 * Created by cuijianhua on 12/21/16.
 */
@Controller
public class Test{
    @Autowired
    StudentService studentService;
    static final Logger logger = Logger.getLogger(Test.class);

    @RequestMapping("/test")
    @ResponseBody
    public String home() throws SQLException {
        List<Student> studentList = studentService.getStudentList();
        for(Student student1: studentList){
            System.out.println("序号为："+student1.getId()+"名字为"+student1.getName());
        }
        logger.info("test log");
        return "hello,world";
    }
}
